package com.example.emos.wx.config.shiro;

import org.springframework.stereotype.Component;

/**
 * @Author yctc
 * @Date 2021/3/8 16:23
 * @Version 1.0
 */
@Component
public class ThreadLocalToken {
    private ThreadLocal<String> local = new ThreadLocal<>();

    public void setToken(String token) {
        local.set(token);  //保存 token
    }

    public String getToken() {
        return local.get(); //获取 token
    }

    public void clear() {
        local.remove();    // 清空ThreadLocal
    }
}
